<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
--> 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
    <ui:composition template="/resources/templates/default.xhtml">
        <ui:define name="title">Importation de données</ui:define>
        <ui:define name="titlePage">Importation de données</ui:define>
        <ui:define name="content">
            <p:panel header="Description">
                <p>Veuillez d'abord créer une nouvelle promotion d'étudiants avant l'importation.</p>
                <p>L'importation du fichier sauvegardera en base de données les élèves de la promotion au préalablement créée.</p>
            </p:panel>
            <p:panel header="Etudiants">  
                <h:form >  
                    <p:fileUpload cancelLabel="Annuler" label="Choisir" uploadLabel="Importer" fileUploadListener="#{fileUploadBean.upload}" mode="advanced" dragDropSupport="false"  
                                    update=":growl :dataImported" process="@(parent)" sizeLimit="100000" fileLimit="3" allowTypes="/(\.|\/)(text|csv)$/" />
                </h:form>
            </p:panel>
            <p:panel id="dataImported" header="Liste des étudiants importés">
                <h:outputText style="padding:10px; font-weight: bold;" value="#{importationBean.imported.size()} importation(s)" rendered="#{not empty importationBean.imported}"/>
                <p:dataTable var="etu" style="margin-top:5px;" emptyMessage="Aucun étudiant importé" value="#{importationBean.imported}">
                    <p:column headerText="LOGIN">
                        #{etu.login}
                    </p:column>
                    <p:column headerText="NOM">
                        #{etu.nom}
                    </p:column>
                    <p:column headerText="PRENOM">
                        #{etu.prenom}
                    </p:column>
                    <p:column headerText="PROMOTION">
                        #{etu.promotion.libelle}
                    </p:column>
                </p:dataTable>
            </p:panel>
        </ui:define>
    </ui:composition>
</html>
